#-*- coding: utf-8 -*-
'''
Created on Aug 22, 2012

@author: bbg
'''
import sys
import os
from sqlalchemy import Integer, Column, String, create_engine, MetaData, Table
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker, mapper, clear_mappers

__all__ = ['company_management', 'companyx', 'shopx', 'reportx']

#MySqlEngine =create_engine("mysql://apkpos:apkpos@58.215.189.116:3306/company_management",pool_size=2,connect_args={"charset":"utf8"})

#MySqlSession = sessionmaker(bind = MySqlEngine)

#Base = declarative_base()
#
#class UserInfoMapping(object):
#    def __init__(self):
#        self.name = ""
#        self.pwd = ""
#        self.shop_id = 0
#        self.phone = ""
#        self.email = ""
#
#
#    
#MySqlEngine = create_engine('mysql://apkpos:apkpos@58.215.189.116:3306/company_1')
#Session = sessionmaker(bind = MySqlEngine)
#
#metaData = MetaData()
#
#userTable = Table('user', metaData, 
#                      Column('id', Integer, primary_key = True),
#                      Column('name', String),
#                      Column('pwd', String),
#                      Column('shop_id', Integer),
#                      Column('phone', String),
#                      Column('email', String))
#
#Mapper = mapper(UserInfoMapping, userTable)
#
#u = UserInfoMapping()
#u.name = '小二'
#u.pwd = 'wbc'
#u.shopId = 2
#
#session = Session()
#
#session.add(u)
#
#session.commit()
#
##-----second table 
##clear_mappers()
#Mapper.dispose()
#
#userTable = Table('user_1', metaData, 
#                      Column('id', Integer, primary_key = True),
#                      Column('name', String),
#                      Column('pwd', String),
#                      Column('shop_id', Integer),
#                      Column('phone', String),
#                      Column('email', String))
#
#Mapper = mapper(UserInfoMapping, userTable)
#
#u = UserInfoMapping()
#u.name = '小a'
#u.pwd = 'wbc'
#u.shopId = 3
#
#session.add(u)
#
#session.commit()
#
#session.close()
